//
//  BaseSearchController.m
//  GiftShow
//
//  Created by 史兴宇 on 16/4/11.
//  Copyright © 2016年 shixingyu. All rights reserved.
//

#import "BaseSearchController.h"

@interface BaseSearchController ()

@end

@implementation BaseSearchController

- (void)dealloc{
    
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"night" object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"day" object:nil];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:@"isNight"];
    
    if (result == YES) {
        
//        self.view.backgroundColor = [UIColor colorWithWhite:0.200 alpha:1.000];
        
       self.searchBar.backgroundColor = [UIColor colorWithWhite:0.200 alpha:1.000];
        
    }else{
        
       self.searchBar.backgroundColor = UIColorFromRGB(0XFF2D47);
    }
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nightAction:) name:@"night" object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dayAction:) name:@"day" object:nil];
    
    
    
}
- (void)nightAction:(NSNotification *)notification {
    
    NSLog(@"夜间模式开启成功");
    
    self.searchBar.backgroundColor = [UIColor colorWithWhite:0.200 alpha:1.000];
    
    
    
}

- (void)dayAction:(NSNotification *)notification {
    
    NSLog(@"日间模式开启成功");
    
    self.searchBar.backgroundColor = UIColorFromRGB(0XFF2D47);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
